package com.testing.class5;

public class Dog {

    int age =0;
    String name="狗狗";

    public static final String LITTLE_DOG_VOICE="呜呜";
    public static final String BIG_DOG_VOICE="汪汪";
    public static final String OLD_DOG_VOICE="嗷嗷";


    public Dog(String name){
        this.name=name;
    }

    public void grow(int growAge){
        age+=growAge;
        bark();
    }

    public void bark(){
        if(age<3&&age>=0){
            System.out.println("小"+name+"正在"+LITTLE_DOG_VOICE);
        }
        else if(age<6){
            System.out.println("大"+name+"正在"+BIG_DOG_VOICE);
        }
        else{
            System.out.println("老"+name+"正在"+OLD_DOG_VOICE);
        }
    }

    public void setAge(){

    }

    public int getAge(){
        return this.age;
    }

    public String toString(){
        return name+"是一条"+age+"岁的狗";
    }

    public static void main(String[] args) {
        Dog haoqi=new Dog("好奇");
        haoqi.grow(2);
        haoqi.grow(3);
        System.out.println(haoqi.toString());
    }

}
